package com.chang.i18n;

import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;

import java.util.Date;
import java.util.Locale;
import java.util.ResourceBundle;

public class ResourceI18n {
    /*public static void main(String[] args) {
        ResourceBundle bundle = ResourceBundle.getBundle("messages", new Locale("zh", "CN"));
        String test = bundle.getString("test");
        System.out.println(test);
        ResourceBundle bundle1 = ResourceBundle.getBundle("messages", new Locale("en", "GB"));
        String test1 = bundle1.getString("test");
        System.out.println(test1);
    }*/

    public static void main(String[] args) {
        ApplicationContext context = new ClassPathXmlApplicationContext("bean.xml");
        Object[] objects = new Object[]{"chang",new Date().toString()};
        String message = context.getMessage("www.chang.com", objects, Locale.CHINA);
        System.out.println(message);
    }
}
